package com.ysyx.ysyx_passengerorderquery.controller;

import com.ysyx.ysyx_passengerorderquery.dto.BaseDto;
import com.ysyx.ysyx_passengerorderquery.service.OrderPojoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;

/**
 * Created by IntelliJ IDEA.
 *
 * @description: xxxx接口/类
 * @author:薛宇晖
 * @create:2023/4/17 15:14
 */
@RestController
public class OrderController {

    @Autowired
    private OrderPojoService orderPojoService;

    /*
     * @Description: (作用)乘客查询订单信息
     * @params:
     * @return:
     * @Author: 郭宇轩
     * @create:2023/4/20
     */
    @RequestMapping(value = "/passenger/getOrderInfo/{orderId}",method = RequestMethod.GET)
    public BaseDto getOrderinfo(@PathVariable String orderId) throws ParseException, InterruptedException {
        BaseDto baseDto = orderPojoService.queryOrderinfo(orderId);
        return baseDto;

    }

    /*
     * @Description: (作用)查询进行中/未支付的订单
     * @params:
     * @return:
     * @Author: 郭宇轩
     * @create:2023/4/20
     */
    @RequestMapping("/passenger/getDoingOrder/{passengerId}")
    public BaseDto getDoing(@PathVariable int passengerId){
        System.out.println("当前乘客id为=="+passengerId);
        return orderPojoService.queryDoingOrderBypassenger(passengerId);

    }





}
